<?php $aPath = Yii::app()->theme->baseUrl . '/assets/'; ?>


<div class="slider-models-wrap">
    <div class="slider-models-wrap__inner">
        <dl class="widget">
            <?php
            $title = isset(Controller::$pageData['_parents']['category']['pageTitle']) ? Controller::$pageData['_parents']['category']['pageTitle'] : '';
            $title = str_replace('Ремонт ', '', $title);
            ?>
            <dt>Ремонт других <?php if (Controller::$pageData['pageId'] == 3139 || Controller::$pageData['pageId'] == 3033) $model = ' ' . Controller::$pageData['_parents']['brand']['pageTitle'] . ' ' . Controller::$pageData['pageTitle'];
            else $model = '';
            echo $title . $model; ?></dt>
            <dd>
                    <?php if (count($models) > 5): ?>
                    <div class="owl-carousel slider-models random-models-slide">

                        <?php
                        foreach ($models as $model) {
                            $src = $this->getController()->getImageUrl('/image/resize/200x200/uploads/images/model/' . $model['pageImages']);
                            echo '<div class="item">
									<div class="slider-models__photo">
										<a class="image_link" href="/' . $model['pageUrl'] . '">
											<img src="' . $src . '" alt="Ремонт ' . Controller::$pageData['_parents']['brand']['pageTitle'] . ' ' . $model['pageTitle'] . '" />
										</a>
									</div>
									<span>
										<a class="title_link" href="/' . $model['pageUrl'] . '">Ремонт ' . Controller::$pageData['_parents']['brand']['pageTitle'] . ' ' . $model['pageTitle'] . '</a>
									</span>					
								</div>';
                        }
                        ?>

                    </div>
                    <?php else: ?>
                    <ul class="models-list">
                        <?php
                        foreach ($models as $model) {
                            $src = $this->getController()->getImageUrl('/image/resize/200x200/uploads/images/model/' . $model['pageImages']);
                            echo '<li>
							<div class="models-list__item">
								<div class="models-list__photo">
									<a href="/' . $model['pageUrl'] . '">
										<img src="' . $src . '" alt="' . $model['pageTitle'] . '" />
									</a>
								</div>
								<span>
									<a  href="/' . $model['pageUrl'] . '">Ремонт ' . Controller::$pageData['_parents']['brand']['pageTitle'] . ' ' . $model['pageTitle'] . '</a>
								</span>
							</div>    
						</li>';
                        }
                        ?>						
                    <?php endif; ?>
            </dd>
        </dl>
    </div>
</div>    
<script>
    $('body').on('click', 'div.slider-models-wrap a', function()
    {
        var content = 'bind-model';
        var action = $(this).text();
        if ($(this).hasClass("image_link"))
        {
            content = 'bind-model-photo';
            action = $(this).find('img').attr("alt");
        }
        mobi03.sendGoogleStatic(content, action, window.location.href);
        window.location.href = $(this).attr("href");
        return false;
    });
</script>